/**
 * Created by Administrator on 2015/9/26.
 */
/*alitab
 author:alicn-wd-ym
 这里是所有js实现,代码比较少,主要还是取巧,利用了classname的关系
 */
var slideTabIndex = 1;
var sTabList = document.getElementById("slideBox").getElementsByTagName("li");
for (var i = 0; i < sTabList.length; i++) {
    var obj = sTabList[i].getElementsByTagName("a")[0];
    sTabList[i].getElementsByTagName("a")[0].id = "slideBtn_" + (i + 1);
    if (obj.addEventListener) {
        obj.addEventListener("mouseover", overSlide, false);
    }
    else if (obj.attachEvent) {
        obj.attachEvent("onmouseover", overSlide);
    }
}
function overSlide(e) {
    e = window.event || e;
    var srcElement = e.srcElement || e.target;
    var newTabIndex = srcElement.id.replace("slideBtn_", "");
    var pos = srcElement.parentNode.className;
    if (newTabIndex == "" || pos.indexOf("_h") != -1)return;
    document.getElementById("slideBtn_" + slideTabIndex).parentNode.className = document.getElementById("slideBtn_" + slideTabIndex).parentNode.className.replace("_h", "");
    document.getElementById("sc_" + slideTabIndex).className = "hide";
    document.getElementById("sc_" + newTabIndex).className = "cont_" + pos;
    srcElement.parentNode.className = pos + "_h";
    slideTabIndex = newTabIndex;
}

function selectTag(showContent, selfObj) {
    // 操作标签
    var tag = document.getElementById("tags").getElementsByTagName("li");
    var taglength = tag.length;
    for (i = 0; i < taglength; i++) {
        tag[i].className = "";
    }
    selfObj.parentNode.className = "selectTag";
    // 操作内容
    for (i = 0; j = document.getElementById("tagContent" + i); i++) {
        j.style.display = "none";
    }
    document.getElementById(showContent).style.display = "block";
}
